home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20021006-20030409 / 000076_fdc@columbia.edu_Wed Nov 13 16:14:32 EST 2002.msg < prev    next >
Text File  |  2020-01-01  |  2KB  |  64 lines

  1. Article: 13842 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: C-Kermit FTP script
  6. Date: 13 Nov 2002 16:14:24 -0500
  7. Organization: Columbia University
  8. Lines: 47
  9. Message-ID: <aqufbg$f0l$1@watsol.cc.columbia.edu>
  10. References: <8ce22d01.0211131301.2d2c8112@posting.google.com>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1037222065 3270 128.59.39.139 (13 Nov 2002 21:14:25 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 13 Nov 2002 21:14:25 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13842
  16.  
  17. In article <8ce22d01.0211131301.2d2c8112@posting.google.com>,
  18. Dan Skinner <JDanSkinner@JDanSkinner.com> wrote:
  19. : ; FTP script from Linux archive to skinner /icsdemo 
  20. : set command quoting on
  21. : set login prompt 
  22. : set network tcp/ip
  23. : if fail end 1 TCP/IP Failed
  24. : set input echo on
  25. : ftp open skinner /user:root /password:xxxxxx
  26. : if fail exit 1 connection failed
  27. : ftp cd /icsdemo
  28. : ftp put jdsmenuarch.tar
  29. : ftp put gbsarch.tar
  30. : quit
  31. : The script above works when the ftp open is correct.
  32. : if also works correctly (fails) if the ftp server does not exist.
  33. : It is broken if the server exists but the login fails.
  34. : IE: the put commands are issued.
  35. : I've made it as simple as I can but can't see what I'm doing wrong.
  36. : Using Linux 8.0.206 on Mandrake distro.
  37. : Skinner is SCO OpenServer 5.04 if that matters?
  38. No.  By default (i.e. unless you have SET FTP AUTOLOGIN OFF),
  39. the FTP OPEN command does two things: makes the connection and
  40. logs you in (perhaps prompting you for your user ID or password).
  41. Thus it can succeed in opening the connection but fail in attempting
  42. to log you in.  The FTP scripting tutorial explains this and shows
  43. how to handle it:
  44.  
  45.   http://www.columbia.edu/kermit/ftpscripts.html
  46.  
  47. Briefly:
  48.  
  49.   ftp open somehost [ /user:xxx [ /password:yyy ] ]
  50.   if fail stop 1 FTP connection failed
  51.   if not \v(ftp_loggedin) stop 1 FTP login failed
  52.   ...
  53.  
  54. You'll also need IF FAIL clauses after all your other FTP commands
  55. if you don't want the script to keep executing after a failed command.
  56.  
  57. Who remembers SNOBOL?  Kermit scripts are kind of like that: with
  58. each statement, you should consider what should be done next if it
  59. succeeds and what should be done if it fails.
  60.  
  61. - Frank
  62.